using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

using dotnetCHARTING.WinForms;
namespace GraphicLibrary
{
    public class MyChart:Chart
    {
        public  const int chartHeight = 250;
        public  const int chartWidth = 700;

        public MyChart(Point position)
        {
            Location = position;
        }


        public void InitializeChart(Chart chartSignal, string xname, string yname, string graphicname)
        {
            chartSignal.Title = graphicname;

            // Set the chart Type
            chartSignal.Type = ChartType.Scatter;

            // Turn 3D off.
            chartSignal.Use3D = false;

            // Set default series type
            chartSignal.DefaultSeries.Type = SeriesType.Spline;

            // Set a default transparency
            chartSignal.DefaultSeries.DefaultElement.Transparency = 20;


            // Set the directory where the images will be stored.
            chartSignal.TempDirectory = "temp";

            // Set the chart size.
            chartSignal.Width = chartWidth;
            chartSignal.Height = chartHeight;

            chartSignal.XAxis.Label.Text = xname;

            // Set the y axis label
            chartSignal.YAxis.Label.Text = yname;

        }

        public static SeriesCollection GetSeriesCollection(double[] x)
        {
            SeriesCollection sc = new SeriesCollection();
            Series series = new Series();
            for (int i = 0; i < x.Length; i++)
            {
                Element elem = new Element();

                elem.YValue = x[i];
                elem.XValue = i;
                series.Elements.Add(elem);
            }
            sc.Add(series);
            sc[0].DefaultElement.Color = Color.Blue;
            return sc;
        }

    }
}
